/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.hpvas.persistence.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author raider
 */
@Entity
@Table(name = "Veterinarian")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Veterinarian.findAll", query = "SELECT v FROM Veterinarian v"),
    @NamedQuery(name = "Veterinarian.findById", query = "SELECT v FROM Veterinarian v WHERE v.id = :id"),
    @NamedQuery(name = "Veterinarian.findBySalary", query = "SELECT v FROM Veterinarian v WHERE v.salary = :salary")})
public class Veterinarian implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Integer id;
    @Lob
    @Column(name = "FocusOfPractice")
    private String focusOfPractice;
    @Lob
    @Column(name = "specialities")
    private String specialities;
    @Column(name = "salary")
    private Integer salary;
    @Lob
    @Column(name = "graduateAt")
    private String graduateAt;
    @OneToMany(mappedBy = "idVeterinarian")
    private Collection<Appointment> appointmentCollection;
    @JoinColumn(name = "idPerson", referencedColumnName = "id")
    @ManyToOne
    private Person idPerson;

    public Veterinarian() {
    }

    public Veterinarian(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getFocusOfPractice() {
        return focusOfPractice;
    }

    public void setFocusOfPractice(String focusOfPractice) {
        this.focusOfPractice = focusOfPractice;
    }

    public String getSpecialities() {
        return specialities;
    }

    public void setSpecialities(String specialities) {
        this.specialities = specialities;
    }

    public Integer getSalary() {
        return salary;
    }

    public void setSalary(Integer salary) {
        this.salary = salary;
    }

    public String getGraduateAt() {
        return graduateAt;
    }

    public void setGraduateAt(String graduateAt) {
        this.graduateAt = graduateAt;
    }

    @XmlTransient
    public Collection<Appointment> getAppointmentCollection() {
        return appointmentCollection;
    }

    public void setAppointmentCollection(Collection<Appointment> appointmentCollection) {
        this.appointmentCollection = appointmentCollection;
    }

    public Person getIdPerson() {
        return idPerson;
    }

    public void setIdPerson(Person idPerson) {
        this.idPerson = idPerson;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Veterinarian)) {
            return false;
        }
        Veterinarian other = (Veterinarian) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Veterinarian[ id=" + id + " ]";
    }
    
}
